package com.ghxxzx.daglcustom.business_test;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.tmsps.ne4spring.base.BaseAction;
import org.tmsps.ne4spring.utils.JsonUtil;
import org.tmsps.ne4spring.utils.wrapper.WrapMapper;
import org.tmsps.ne4spring.utils.wrapper.Wrapper;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/data")
public class DataTestAction extends BaseAction {

	@GetMapping("/list")
	public String list() {
		List<Map<String, Object>> list = new ArrayList<>();
		for (int i = 0; i < 10; i++) {
			Map<String, Object> map = new HashMap<>();
			map.put("label", "选型" + i);
			map.put("value", i);
			list.add(map);
		}

		return JsonUtil.toJson(list);
	}

	@GetMapping("/tree")
	public Wrapper<String> tree() {

		return WrapMapper.ok();
	}

}
